import axios from '../request';
import { Exhibit, ExhibitList, ExhibitRelate } from '../model/exhibit';

// 更换资料
export const exhibitSave = (params: Exhibit) => {
  // 返回的数据格式可以和服务端约定
  return axios.post<any>(`api/showpiece/save`, params);
};
export const exhibitDirection = () => {
  // 返回的数据格式可以和服务端约定
  return axios.get<any>(`api/showpiece/direction`, {});
};
export const exhibitInfo = (parmas: number) => {
  // 获取展品详情
  return axios.get<any>(`api/showpiece/${parmas}`, {});
};
export const exhibitDisable = (parmas: number) => {
  // 移动到回收站
  return axios.put<any>(`api/showpiece/disable/${parmas}`, {});
};
export const exhibitRecovery = (parmas: string) => {
  // 从回收站回复
  return axios.put<any>(`api/showpiece/recovery/${parmas}`, {});
};
export const exhibitMove = (parmas: number) => {
  // 移动私有库公有库
  return axios.put<any>(`api/showpiece/move/${parmas}`, {});
};
export const exhibitPublish = (parmas: number) => {
  //发布
  return axios.put<any>(`api/showpiece/publish/${parmas}`, {});
};
export const exhibitWithdrawn = (parmas: number) => {
  //发布撤回
  return axios.put<any>(`api/showpiece/withdrawn/${parmas}`, {});
};
export const enterpriseList = (parmas: ExhibitList) => {
  // 获取展品数据
  return axios.post<any>(`api/showpiece/companyData`, parmas);
};
export const showpieceList = (parmas: ExhibitList) => {
  // 获取展品数据
  return axios.post<any>(`api/showpiece/list`, parmas);
};
export const showpieceRelate = (projectId: string, parmas: ExhibitRelate) => {
  // 获取展品数据
  return axios.get<any>(`api/showpiece/Relate/${projectId}`, parmas);
};
interface ModuleInfo {
  id: number;
  value?: string;
  pageNo: number;
  pageSize: number;
}
export const moduleShowpieces = (projectId: string, parmas: ModuleInfo) => {
  // 获取项目展品数据
  return axios.get<any>(`api/exhibition/moduleShowpieces/${projectId}`, parmas);
};
//绑定项目展品
export const bindShowpieces = (projectId: number, moduleId: number, moveId: number, parmas: any) => {
  // 获取展品数据
  return axios.post<any>(`api/exhibition/bindShowpieces/${projectId}/${moduleId}/${moveId}`, parmas);
};
//绑定项目展品
export const projectShowpieceSort = (projectId: number, showpieceId: number, sort: number) => {
  // 获取展品数据
  return axios.put<any>(`/api/exhibition/ShowpieceSort/${projectId}/${showpieceId}/${sort}`);
};
//获取pdf导出数据
export const getPDFexportList = (projectId: number | string, isShow?: boolean) => {
  return axios.get<any>(`/api/exhibition/exportData/${projectId}?isShow=${isShow ? isShow : false}`);
};
//获取word导出文件
export const getWordexport = (projectId: number | string, isShow?: boolean) => {
  return axios.get<any>(`/api/exhibition/export/${projectId}?isShow=${isShow ? isShow : false}`);
};
//排序
export const projectShowpieceSorts = (projectId: number, data: Array<number>) => {
  // 获取展品数据
  return axios.put<any>(`/api/exhibition/ShowpieceSorts/${projectId}`, data);
};
interface ModuleInfo {
  refType: number;
  text: string;
  refId: number;
}
export const createdTSAudio = (parmas: ModuleInfo) => {
  // 创建音频任务
  return axios.post<any>(`api/exhibition/dTSAudio`, parmas);
};
export const queryTSAudio = (taskId: number | string) => {
  // 查询音频任务
  return axios.get<any>(`api/exhibition/dTSAudio/${taskId}`, {});
};